<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="java.util.HashMap"%>
<%@page import="com.is.datatransform.SelectOptionValue"%>
<%@page import="java.util.Map"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="../../resources/js/jquery-1.8.1.js"></script>
<link rel="stylesheet" type="text/css" href="../../resources/css/common.css"/>
<script type="text/javascript">
	$(function(){
		var options = $("input[name='options']");
		var form = document.getElementsByName("forms")[0];
		form.onsubmit = function(e){
			var temarr = [];
			if(e && e.preventDefault){
				e.preventDefaule;
			} else{
				window.event.returnValue = false;
			}
			options.each(function(i){
				if(options[i].checked){
					temarr.push(options[i].value);
				}
			})
			$("[name='ops']")[0].value = temarr.join(",");
			if(temarr.length>0){
				form.submit();
			} else{
				return false;
			}
		}
		$("tr td:even:lt(3)").css({"text-align":"center","background":"#7BC671","color":"#fff"});
		$("tr td:even").css({"text-align":"center"});
		$("tr td:odd").css({"text-indent":"20px"});
		$("[name='selectall']").click(function(){
			$("[name='selectnone']").attr("checked",false);
			if($("[name='options']:checked").size()>=0 && $("[name='options']:checked").size() != $("[name='options']").size()){
				$("[name='options']").attr("checked",true);
				$(this).attr("checked",true);
			} else{
				$("[name='options']").attr("checked",false);
				$(this).attr("checked",false);
			}
			
		})
		$("[name='selectnone']").click(function(){
			$("[name='selectall']").attr("checked",false);
			$("[name='options']").each(function(i){
				if($("[name='options']").eq(i).attr("checked")){
					$("[name='options']").eq(i).attr("checked",false);
				} else{
					$("[name='options']").eq(i).attr("checked",true);
				}
			})
		})
		$("[type='checkbox']").css({"vertical-align":"middle","display":"inline-block","margin-right":"4px"});
	})
</script>
<title>选择您要导出的列</title>
<style type="text/css">
	.span{display:inline-block; width:100px; float:left; text-align:left; height:22px;}
	table{width:430px; margin:40px auto; border:1px solid #ccc;}
	table tr td{border:1px solid #ccc; padding:10px 0}
	.button,button,input[type="submit"],input[type="button"],input[type="reset"]{display:inline-block; background:#6763BB; padding:2px 8px; border:1px; box-shadow:1px 2px 2px #6763BB; color:#fff; cursor:pointer; font-size:12px; letter-spacing:2px;}
	caption{height:30px; line-height:30px; text-align:center; font-size:14px; }
</style>
</head>
<body>
<form name="forms" action="export_deal.jsp"  method="post">
<table>
	<caption>请选择您所需的字段</caption>
	<tr>
		<td width='120'>全选</td>
		<td><input type="checkbox" name="selectall"/>选中所有字段</td>
	</tr>
	<tr>
		<td>反选</td>
		<td><input type="checkbox" name="selectnone"/>反选所有字段</td>
	</tr>
	<tr>
		<td>其他</td>
		<td>
			<%
         		HashMap<String,String> map = SelectOptionValue.StudentOptions();
				for(Map.Entry<String, String> mi:map.entrySet()){
				    %>
				    <span class="span"><input type="checkbox" name="options"  value="<%=mi.getKey() %>"/><%=mi.getValue() %></span>
				    <%
					//System.out.println(mi.getKey()+"  "+mi.getValue());
				}
			%>
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<input type="hidden" name="ops" />
			<input type="submit" value="导出">
		</td>
	</tr>
</table>
</form>
<%


%>
</body>
</html>